home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Tools & Apps / Devices & Hardware / A⁄ROSE / MessageDispatcher / MessageDispatcher.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-30  |  1.3 KB  |  67 lines  |  [TEXT/MPS ]

  1. /*
  2.     Header file for Message Dispatcher
  3.     
  4.     You can call OpenDispatch to start the dispatcher
  5.     
  6.     You can call Receive multiple times with different completion routines
  7.         The message selection can be different.
  8.         The first match is used
  9.     
  10.     You can call CloseDispatch to stop the dispatcher
  11.     
  12.     Written by:    Anumele D. Raja
  13.     
  14.     Date:        April 18, 1991
  15.     
  16.     Copyright @ Apple Computer, Inc.  1991
  17.     
  18. */
  19.  
  20. #ifndef    __MESSAGEDISPATCHER__
  21. #define    __MESSAGEDISPATCHER__
  22.  
  23. #ifndef __MEMORY__
  24. #include <Memory.h>
  25. #endif
  26.  
  27. #ifndef    _os_defined_
  28. #include    "os.h"
  29. #endif
  30.  
  31. #define kNoOfDispatchEntriesInBlock        16
  32.  
  33. #define    kFailedReceive        -66
  34.  
  35. struct MessageQueue {
  36.     int            fMsgCount;
  37.     mMessage    *fMsgPtr[];
  38. };
  39.  
  40. typedef struct MessageQueue MessageQueue;
  41.  
  42. struct DispatchEntry {
  43.         int            fFlag;
  44.         long         fMsgId;
  45.         tid_type     fMsgFrom;
  46.         short         fMsgCode;
  47.         long        fTimeOut;
  48.         void        (*fComplRout)(mMessage *);
  49. };
  50.  
  51. typedef struct DispatchEntry DispatchEntry;
  52.  
  53. typedef struct DispatchTable DispatchTable;
  54.  
  55. struct DispatchTable {
  56.     DispatchTable    **fNext;
  57.     DispatchEntry    disEntry[kNoOfDispatchEntriesInBlock];
  58. };
  59.  
  60. void OpenDispatch(int queueSize);
  61. void CloseDispatch(void);
  62. void SetSpecialReceive(void);
  63. void RestoreOriginalReceive(void);
  64. mMessage *SpecialReceive(unsigned long msgId, tid_type msgFrom,
  65.         unsigned short msgCode, long timeOut, void (*complRout)(mMessage *));
  66.  
  67. #endif